﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

namespace paper.evisa99.com.Controllers.Class
{
    public class Record
    {
        ///====================================================================member
        public void CreateMember(string Merchant, string AccountID, string MemberID, string ComeFrom, string UserName,
            string Surname, string PersonalName, string IdCard, string DebitCard = "", string CreditCard = "")
        {
            Class.DB.SqlStr = "Sp_CreateMember";
            Class.DB.InitParam();
            Class.DB.InstParam("@Merchant", Merchant);
            Class.DB.InstParam("@AccountID", AccountID);
            Class.DB.InstParam("@MemberID", MemberID);
            Class.DB.InstParam("@ComeFrom", ComeFrom);
            Class.DB.InstParam("@UserName", UserName);
            Class.DB.InstParam("@Surname", Surname);
            Class.DB.InstParam("@PersonalName", PersonalName);
            Class.DB.InstParam("@IdCard", IdCard);
            Class.DB.InstParam("@DebitCard", DebitCard);
            Class.DB.InstParam("@CreditCard", CreditCard);
            Class.DB.ExecSpWithParam();
            Class.DB.DropParam();
        }
        ///------------------------------------------------------------------------------------------------------
        public DataTable GetMemberInfo( string MemberID)
        {
            Class.DB.SqlStr = "SELECT TOP 1 * FROM [Member]";
            Class.DB.SqlStr += " WHERE ([MemberID]=@MemberID)";
            Class.DB.InitParam();
            Class.DB.InstParam("@MemberID", MemberID);
            DataTable info = Class.DB.SelectSqlWithParam();
            Class.DB.DropParam();
            return info;
        }
        ///------------------------------------------------------------------------------------------------------

        ///====================================================================itinerary
        public void CreateItinerary(string MemberID, string CountryCode)
        {
            Class.DB.SqlStr = "INSERT INTO [Itinerary_" + CountryCode + "] (MemberID) VALUES (@MemberID)";
            Class.DB.InitParam();
            Class.DB.InstParam("@MemberID", MemberID);
            Class.DB.ExecSqlWithParam();
            Class.DB.DropParam();
        }
        ///------------------------------------------------------------------------------------------------------
        public DataTable GetItineraryInfo(string MemberID, string CountryCode)
        {
            Class.DB.SqlStr = "SELECT TOP 1 * FROM [Itinerary_" + CountryCode + "]";
            Class.DB.SqlStr += " WHERE ([MemberID]=@MemberID)";
            Class.DB.InitParam();
            Class.DB.InstParam("@MemberID", MemberID);
            DataTable info = Class.DB.SelectSqlWithParam();
            Class.DB.DropParam();
            return info;
        }
        ///------------------------------------------------------------------------------------------------------

        ///====================================================================
    }
}